home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
JCSM Shareware Collection 1993 November
/
JCSM Shareware Collection - 1993-11.iso
/
cl720
/
sst115j.lzh
/
SSTFOS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-08-01
|
12KB
|
365 lines
/* ------------------------------------------------------------------------ */
/* sstfoss.c */
/* */
/* Revision 5 FOSSIL interface layer */
/* CopyRight (C) 1991,1992 Steven Lutrov. All rights reserved. */
/* ------------------------------------------------------------------------ */
#include <dos.h>
#include "sstfos.h"
/* ------------------------------------------------------------------------ */
/* function 0x00 - Set baud rate */
/* ------------------------------------------------------------------------ */
unsigned int finit(unsigned int p, unsigned int b)
{
_AH = 0x00;
_AL = b;
_DX = p;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x01 Transmit character with wait */
/* ------------------------------------------------------------------------ */
unsigned int fputch(unsigned int p, char c)
{
_AH = 0x01;
_AL = c;
_DX = p;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x02 Receive character with wait */
/* ------------------------------------------------------------------------ */
unsigned int fgetch(unsigned int p)
{
_AH = 0x02;
_DX = p;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x03 Request status */
/* ------------------------------------------------------------------------ */
unsigned int fstatus(unsigned int p)
{
_AH = 0x03;
_DX = p;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x04 initialize driver */
/* ------------------------------------------------------------------------ */
unsigned int ffinit(unsigned int p, unsigned int *f, char far *fb)
{
_AH = 0x04;
_BX = *f;
if (_BX == 0x4F50) {
_ES = FP_SEG(fb);
_CX = FP_OFF(fb);
}
_DX = p;
geninterrupt(0x14);
_CX = _BX;
*f = _CX;
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x05 deinitialize driver */
/* ------------------------------------------------------------------------ */
void fdeinit(unsigned int p)
{
_AH = 0x05;
_DX = p;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x06 raise/lower DTR */
/* ------------------------------------------------------------------------ */
void fdtr(unsigned int p, unsigned int d)
{
_AH = 0x06;
_AL = d;
_DX = p;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x07 return timer tick parameters */
/* ------------------------------------------------------------------------ */
unsigned int ftickparms(unsigned int *ms)
{
_AH = 0x07;
geninterrupt(0x14);
*ms = _DX;
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x08 flush output buffer */
/* ------------------------------------------------------------------------ */
void fflushout(unsigned int p)
{
_AH = 0x08;
_DX = p;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x09 purge output buffer */
/* ------------------------------------------------------------------------ */
void fpurgeout(unsigned int p)
{
_AH = 0x09;
_DX = p;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x0A purge input buffer */
/* ------------------------------------------------------------------------ */
void fpurgein(unsigned int p)
{
_AH = 0x0A;
_DX = p;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x0B transmit character without wait */
/* ------------------------------------------------------------------------ */
unsigned int fpoke(unsigned int p, char c)
{
_AH = 0x0B;
_AL = c;
_DX = p;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x0C nondestructive read-ahead */
/* ------------------------------------------------------------------------ */
unsigned int fpeek(unsigned int p)
{
_AH = 0x0C;
_DX = p;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x0D keyboard read without wait */
/* ------------------------------------------------------------------------ */
unsigned int fkbdpeek(void)
{
_AH = 0x0D;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x0E keyboard read with wait */
/* ------------------------------------------------------------------------ */
unsigned int fkbdgetch(void)
{
_AH = 0x0E;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x0F enable or disable flow control */
/* ------------------------------------------------------------------------ */
void fflow(unsigned int p, unsigned char m)
{
_AH = 0x0F;
_AL = m;
_DX = p;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x10 extended control-C/-K checking and transmit on/off */
/* ------------------------------------------------------------------------ */
unsigned int fcontrol(unsigned int p, unsigned char m)
{
_AH = 0x10;
_AL = m;
_DX = p;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x11 set current cursor location */
/* ------------------------------------------------------------------------ */
void fgotoxy(unsigned int x, unsigned int y)
{
_AH = 0x11;
_DL = x;
_DH = y;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x12 read current cursor location */
/* ------------------------------------------------------------------------ */
unsigned int fwherexy(unsigned int *x, unsigned int *y)
{
_AH = 0x12;
geninterrupt(0x14);
if (x)
*x = _DL;
if (y)
*y = _DH;
return(_DX);
}
/* ------------------------------------------------------------------------ */
/* function 0x13 single character ANSI write to screen */
/* ------------------------------------------------------------------------ */
void fdispansi(char c)
{
_AH = 0x13;
_AL = c;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x14 enable or disable carrier watchdog processing */
/* ------------------------------------------------------------------------ */
void fwatchdog(unsigned int p, int f)
{
_AH = 0x14;
_AL = f;
_DX = p;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x15 write character to screen via BIOS */
/* ------------------------------------------------------------------------ */
void fdispbios(char c)
{
_AH = 0x15;
_AL = c;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x16 insert or delete a function from the timer tick chain */
/* ------------------------------------------------------------------------ */
unsigned int ftickchain(int a, void (far *func)())
{
_AH = 0x16;
_AL = a;
_ES = FP_SEG(func);
_DX = FP_OFF(func);
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x17 reboot system */
/* ------------------------------------------------------------------------ */
void freboot(unsigned int w)
{
_AH = 0x17;
_AL = w;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x18 read block transfer */
/* ------------------------------------------------------------------------ */
unsigned int fgetblk(unsigned int p, void far *buf, unsigned int z)
{
_AH = 0x18;
_ES = FP_SEG(buf);
_DI = FP_OFF(buf);
_CX = z;
_DX = p;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x19 write block transfer */
/* ------------------------------------------------------------------------ */
unsigned int fputblk(unsigned int p, void far *buf, unsigned int z)
{
_AH = 0x19;
_ES = FP_SEG(buf);
_DI = FP_OFF(buf);
_CX = z;
_DX = p;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x1A break begin or end */
/* ------------------------------------------------------------------------ */
void fbreak(unsigned int p, unsigned int f)
{
_AH = 0x1A;
_AL = f;
_DX = p;
geninterrupt(0x14);
}
/* ------------------------------------------------------------------------ */
/* function 0x1B return information about driver */
/* ------------------------------------------------------------------------ */
unsigned int finfo(unsigned int p, void far *buf, unsigned int z)
{
_AH = 0x1B;
_ES = FP_SEG(buf);
_DI = FP_OFF(buf);
_CX = z;
_DX = p;
geninterrupt(0x14);
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x7E install an "external application" function */
/* ------------------------------------------------------------------------ */
unsigned int faddapp(unsigned int p, unsigned int *c, void (far *func)())
{
_AH = 0x7E;
_AL = *c;
_ES = FP_SEG(func);
_DX = FP_OFF(func);
_DX = p;
geninterrupt(0x14);
*c = _BX;
return(_AX);
}
/* ------------------------------------------------------------------------ */
/* function 0x7F remove an "external application" function */
/* ------------------------------------------------------------------------ */
unsigned int fdelapp(unsigned int p, unsigned int *c, void (far *func)())
{
_AH = 0x7F;
_AL = *c;
_ES = FP_SEG(func);
_DX = FP_OFF(func);
_DX = p;
geninterrupt(0x14);
*c = _BX;
return(_AX);
}